package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.MyMessageRelation;
import cn.wolfcode.trip.base.domain.SystemInform;
import cn.wolfcode.trip.base.mapper.MyMessageRelationMapper;
import cn.wolfcode.trip.base.service.IMyMessageRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyMessageRelationServiceImpl implements IMyMessageRelationService {

    @Autowired
    private MyMessageRelationMapper myMessageRelationMapper;

    public Integer getCommentTotalByUserId(Long id) {
        Integer i = myMessageRelationMapper.getCommentTravelTotalByUserId(id);
        Integer p = myMessageRelationMapper.getCommentCommentTotalByUserId(id);
        return i+ p ;
    }

    @Override
    public Integer getSmsTotalByUserId(Long id) {
        return myMessageRelationMapper.selectSmsTotalByUserId(id);
    }

    public List<MyMessageRelation> getLikeTravelMessageByUserId(Long id, Integer type) {
        return myMessageRelationMapper.selectTypeByLikeTravel(type,id);
    }

    @Override
    public void deleteById(Long id) {
        myMessageRelationMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<MyMessageRelation> getTravelAndUserByComment(Long id, Integer type) {
        return myMessageRelationMapper.selectCommentTypeByTravel(type,id);
    }

    @Override
    public List<MyMessageRelation> getCommentAndCommentByUserId(Long id, Integer type) {
        return myMessageRelationMapper.selectCommentTypeByComment(type,id);
    }

    @Override
    public List<MyMessageRelation> getSmsByUserId(Long id, Integer type) {
        return myMessageRelationMapper.selectSmsTypeByUser(type,id);
    }

    @Override
    public List<SystemInform> getSystemMessageByUserId(Long id) {
        return myMessageRelationMapper.selectSystemMessageByUserId(id);
    }

    @Override
    public Integer getSystemMessageTotalByUserId(Long id) {
        return myMessageRelationMapper.selectSystemMessageTotalByUserId(id);
    }
}
